<template>
	<view class="components-home">
		<view class="bgImg">
			<view class="bannerBox">
				<swiper style="height: 480rpx;" class="swiper" @change="cardSwiper" circular="true"
					indicator-dots="true" autoplay="true" interval="4000" duration="600">
					<swiper-item class="swiper-list" v-for="(item, index) in bannerList" :key="index">
						<view class="swiper-item uni-bg-red">
							<image class="swiper-img radius shadow-warp" :src="item.imageUrl" mode="widthFix"></image>
						</view>
					</swiper-item>
				</swiper>
				<view class="indication">
					<block v-for="(item,index) in bannerList" :key="index">
						<view class="spot" :class="cardCur == index ? 'active': '' "></view>
					</block>
				</view>
			</view>
		</view>
		
		<view class="mainBox flex justify-between">
			<view @click="goWatching" class="mainBtn shadow-warp radius bg-white padding-sm margin-xs radius text-center">
				<view style="text-align: center;">
					<image src="/static/click_to_test.png" mode="widthFix"
						style="width: 125rpx;border-radius: 20rpx;"></image>
				</view>
				<view class="text-bold text-black text-lg margin-top-sm text-shadow">点击进行检测</view>
			</view>
			<view @click="goInstruction"
				class="mainBtn shadow-warp radius bg-white padding-sm margin-xs radius text-center">
				<view style="text-align: center;">
					<image src="/static/use_info.png" mode="widthFix" style="width: 125rpx;">
					</image>
				</view>
				<view class="text-bold text-black text-lg margin-top-sm text-shadow">使用说明</view>
			</view>
		</view>
		<view class="divider"></view>
    <sitting-infos :myInfos="mySittingInfos"></sitting-infos>
	</view>
</template>

<script>
	export default {
		props: ['indexSittingInfos'],
		data() {
			return {
				cardCur: 0,
				bannerList: [
					{
						imageUrl: 'https://cdn.zhoukaiwen.com/qh_banner8.jpg'
					}
				],
				modalName: null, //会员弹窗
				mySittingInfos : this.indexSittingInfos,
			}
		},
		methods: {
			 open(){
					// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
					this.$refs.popup.open('top')
			},
			showModal() {
				this.modalName = 'Modal'
			},
			hideModal() {
				this.modalName = null;
			},
			cardSwiper(e) {
				this.cardCur = e.detail.current
			},
			goWatching() {
				uni.navigateTo({
					url: './watching'
				})
			},
			goInstruction() {
				uni.navigateTo({
					url: './instuctions'
				})
			},
			goBasic(){
				uni.showToast({
				    title: '正在开发中...',
					icon: 'none',
				    duration: 2000
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.divider {
	  border-top: 1px solid #000; /* 黑色的1px宽实线 */
	  margin: 80rpx 0; /* 上下外边距 */
	}
	.swiper-item {
		height: 100%;
	}
	/* 轮播指示点 start*/
	.indication {
		z-index: 9999;
		width: 100%;
		height: 36rpx;
		position: absolute;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}
	.spot {
		background-color: #FFFFFF;
		opacity: 0.6;
		width: 10rpx;
		height: 10rpx;
		border-radius: 20rpx;
		top: -130rpx;
		margin: 0 8rpx !important;
		position: relative;
	}

	.spot.active {
		opacity: 1;
		width: 30rpx;
		background-color: #0081ff;
	}

	.bgImg {
		position: relative;
		margin-bottom: 100rpx;

		.left_box {
			position: absolute;
			height: 130rpx;
			width: 60%;
			background: #ffffff;
			bottom: -55rpx;
			left: 5%;
			border-radius: 15rpx;
		}

		.right_box {
			text-align: center;
			position: absolute;
			height: 130rpx;
			width: 25%;
			background: #ffffff;
			bottom: -55rpx;
			right: 5%;
			border-radius: 15rpx;
		}
	}

	.mainBox {
		width: 750rpx;
		height: 150rpx;
		padding: 0 5%;
		margin-bottom: 10rpx;

		.mainBtn {
			width: 45%;
		}
	}

	.radius {
		border-radius: 18rpx !important;
	}

	// 弹窗
	.cu-dialog {
		background: #FFFFFF;
		overflow: visible;
	}

	.modal_bg {
		width: 100%;
		height: 400rpx;
		position: absolute;
		top: -100rpx;
		background-image: url(https://zhoukaiwen.com/img/qdpz/modal_bg.png);
		background-size: 100%;
		background-repeat: no-repeat;
	}

	.modal_main {
		text-align: left;
		background-color: #FFFFFF;
	}

	.title-header {
		position: absolute;
		bottom: 0;
		width: 100%;
		display: flex;
		height: 120rpx;
		font-size: 40rpx;
		align-items: center;
		justify-content: center;
		font-weight: bold;
		background-image: url(https://cdn.zhoukaiwen.com/wccswF.png);
		background-size: cover;
	}

	.title-text {
		background-image: -webkit-linear-gradient(0deg, #ff8a34, #FBBD12);
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
	}
</style>
